package openbee;

import java.util.ArrayList;
import java.util.List;

public class Coordinator extends Node
{
	private List<Node> nodes;

	public Coordinator()
	{
		nodes = new ArrayList<Node>();
	}
	
	public List<Node> getNodes() {
		return nodes;
	}

	public void setNodes(List<Node> nodes) {
		this.nodes = nodes;
	}
	
	public void addNode(Node node)
	{
		if (nodes != null)
		{
			if (findNode(node) == null)
				nodes.add(node);		
		}
	}
	
	public void clearNodes()
	{
		if (nodes != null)
			nodes.clear();			
	}
	
	private Node findNode(Node node)
	{
		for (Node nodeToComapre : nodes)
		{
			if (nodeToComapre.getEui64().equals(node.getEui64()))
				return node;
		}
		return null;
	}
	

}
